﻿using System.Reflection;
namespace XC.DataAccess.EncoderDecoder
{
    /// <summary>
    /// 字节码转换器
    /// </summary>
    public class ByteConverter : IEncoderConverter
    {
        public byte[] Encode<T>(T data, PropertyInfo[] propertyInfos, object source, EncoderAttribute encoderAttribute)
        {
            if (data is byte res)
            {
                return new byte[] { res };
            }
            else
            {
                throw new TypeNotMatchException(typeof(byte), data.GetType());
            }
        }
    }
}
